﻿namespace Vdc.Grid
{
    using Vdc.Grid.Design;
    using System;
    using System.ComponentModel;

    [TypeConverter(typeof(GridFilteringSettingsConverter))]
    public class GridFilteringSettings : GridPersistentObject, ICloneable
    {
        public object Clone()
        {
            return new GridFilteringSettings { FilterLinksPosition = this.FilterLinksPosition, FilterPosition = this.FilterPosition, InitialState = this.InitialState, MatchingType = this.MatchingType };
        }

        public virtual bool Equals(GridFilteringSettings settings)
        {
            return (((this.FilterLinksPosition == settings.FilterLinksPosition) && (this.FilterPosition == settings.FilterPosition)) && ((this.InitialState == settings.InitialState) && (this.MatchingType == settings.MatchingType)));
        }

        object ICloneable.Clone()
        {
            return this.Clone();
        }

        [NotifyParentProperty(true), Category("Paging"), Bindable(true), DefaultValue(1), Description("Gets or sets a value indicating the location where the filter links will be displayed.")]
        public GridElementPosition FilterLinksPosition
        {
            get
            {
                object obj2 = base.ViewState["FilterLinksPosition"];
                if (obj2 != null)
                {
                    return (GridElementPosition) obj2;
                }
                return GridElementPosition.Bottom;
            }
            set
            {
                base.ViewState["FilterLinksPosition"] = value;
            }
        }

        [Category("Filtering"), NotifyParentProperty(true), DefaultValue(1), Description("The position of the filter."), Bindable(true)]
        public GridFilterPosition FilterPosition
        {
            get
            {
                object obj2 = base.ViewState["FilterPosition"];
                if (obj2 != null)
                {
                    return (GridFilterPosition) obj2;
                }
                return GridFilterPosition.Bottom;
            }
            set
            {
                base.ViewState["FilterPosition"] = value;
            }
        }

        [NotifyParentProperty(true), Description("The initial state of the filter."), DefaultValue(1), Category("Filtering"), Bindable(true)]
        public GridFilterState InitialState
        {
            get
            {
                object obj2 = base.ViewState["InitialState"];
                if (obj2 != null)
                {
                    return (GridFilterState) obj2;
                }
                return GridFilterState.Hidden;
            }
            set
            {
                base.ViewState["InitialState"] = value;
            }
        }

        [Category("Filtering"), Bindable(true), DefaultValue(1), NotifyParentProperty(true), Description("Indicates the way in which the results are matched against the specified filters.")]
        public GridFilterMatchingType MatchingType
        {
            get
            {
                object obj2 = base.ViewState["MatchingType"];
                if (obj2 != null)
                {
                    return (GridFilterMatchingType) obj2;
                }
                return GridFilterMatchingType.AllFilters;
            }
            set
            {
                base.ViewState["MatchingType"] = value;
            }
        }
    }
}

